package com.cloud.basic.Callback;

/**
 * @program: basic
 * @description: 代理模式
 * @author: Cloud
 * @create: 2021/4/17 13:44:01
 */
public class Tools1 {

    public   void  testTime(Callback callBack) {
        System.out.println(2);
        long  begin = System.currentTimeMillis(); //测试起始时间
        callBack.execute(); //进行回调操作
        long  end = System.currentTimeMillis(); //测试结束时间
        System.out.println("[use time]:"  + (end - begin)); //打印使用时间
    }

    public static void main(String[] args) {
        Tools1 tools1 = new Tools1();
        // 让代理对象去实现去调用方法
        Proxy proxy = new Proxy(new MyCallBack());
        tools1.testTime(proxy);
    }
}
